const TOKEN_KEY = 'itcast_geek_pc'

// 获取token
const getToken = () => localStorage.getItem(TOKEN_KEY)
// 存储token
const setToken = token => localStorage.setItem(TOKEN_KEY, token)
// 清除token
const clearToken = () => localStorage.removeItem(TOKEN_KEY)
// 是否已登录=> 鉴权 (判断是否有token) => 场景:判断一个值是否为空、undefined、null =>
// 语法：!!空、undefined、null === false
/**
 * 
 * @returns true 有token(登录) | false 没有token(没有登录)
 */
const isAuth = () => !!getToken()

export { isAuth, getToken, setToken, clearToken }